Skip to content

fix(vscode): prevent transcript handoff flicker - #14044

Merged
marius-kilocode merged 2 commits into
mainfrom
fix-bash-tool-flicker-after-reasoning
Sep 14, 2026
Merged

marius-kilocode merged 2 commits into
mainfrom
fix-bash-tool-flicker-after-reasoning

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The VS Code transcript can flicker briefly when a reasoning block is followed by parallel bash tools and the agent starts its next step. The visible symptom is a short jump down and back up around the second shell card.

Why This Change Was Made

The transcript intentionally keeps the growing assistant suffix outside Virtua. When a new assistant message starts, the previous assistant row moves from the direct tail into Virtua. Virtua initially assigns a new row its itemSize estimate of 260px, while the real row in this scenario is about 546px tall.

The sequence was:

  1. The mutation observer auto-scrolled against the 260px estimate.
  2. The browser clamped scrollTop to the shorter layout.
  3. Virtua's ResizeObserver measured the real row and expanded the layout.
  4. The content resize observer re-pinned on the next frame, leaving one painted frame at the wrong scroll position.

The fix measures newly handed-off virtual rows in a microtask and re-pins before the next paint. It only runs when the virtual row list grows at the end within the same session, so session changes, prepending older messages, and user-paused scrolling are not treated as handoffs.

The repository already patches Virtua 0.49.1 with a synchronous VirtualizerHandle.measure() API, but that patch previously changed only lib/solid/index.jsx. The VS Code webview esbuild configuration resolves the package's default Solid entry, lib/solid/index.js, rather than the solid conditional JSX entry. Therefore the method existed in the TypeScript declaration and JSX source but was missing from the runtime entry used by the webview. This PR mirrors the existing patch in the compiled entry so the runtime API used by the fix exists where it is bundled.

Updating Virtua did not remove the need for this change. The current latest release still exposes no measure() method in the compiled Solid handle, and the existing 0.49.1 patch remains the fork's source of the synchronous measurement behavior.

User Impact

The transcript remains pinned to the bottom without a one-frame vertical twitch when the next reasoning step begins after tool calls. User-paused scrolling remains unchanged.

Evidence

  • Baseline self-test reproduced the scroll reversal in 3/3 synthetic streams matching the real event order: reasoning, two parallel bash calls, step finish, completed assistant message, then a new reasoning message.
  • Baseline post-paint samples showed scrollTop changing from 139 to 127 while scrollHeight was already 725, then recovering to 216.5 on the next frame.
  • The fixed build had no position reversals or scroll reversals in 3/3 runs. Samples moved directly from the previous bottom to the corrected bottom.
  • bun run typecheck passed in packages/kilo-vscode.
  • bun run lint passed in packages/kilo-vscode.
  • bun run test:unit passed, 5,528 tests across 418 files.
  • The focused self-test used an isolated VS Code instance and was cleaned up after verification.

@kilo-code-bot

kilo-code-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • .changeset/transcript-step-handoff-flicker.md
  • packages/kilo-vscode/webview-ui/src/components/chat/MessageList.tsx
  • patches/virtua@0.49.1.patch

Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants